<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.setPopupBlockingEnabled(false);
    testRunner.overridePreference('WebKitSupportsMultipleWindows', false);
    testRunner.waitUntilDone();
}

function runTest()
{
    if (window.testRunner)
        var windowCount = testRunner.windowCount();
    var result = window.open('data:text/html;charset=utf-8,<html><body>The test passes if this page opens in the same window</body></html>');
    if (window.testRunner) {
        if (!result)
            document.writeln('FAIL: window.open failed. You need popups to be enabled to run this test.');
        else if (windowCount != testRunner.windowCount())
            document.writeln('FAIL: Popup opened in a new window');
        else
            document.writeln('PASS: Popup opened in the same window');
        testRunner.notifyDone();
    }
}

window.addEventListener('load', runTest, true);
</script>
</head>
<body>
You need popups to be enabled to run this test.
</body>
</html>
